#include "syscall-table-init.h"

#include "console.h"
#include "memory.h"
#include "print.h"
#include "stdint.h"
#include "string.h"
#include "syscall-handler.h"
#include "thread.h"

void* syscall_table[SYSCALL_NR];

uint32_t sys_getpid() { return cur_thread_PCB_get()->pid; }

uint32_t sys_write(char* str)
{
  console_put_str(str);
  return strlen(str);
}

void syscall_init()
{
  put_str("syscall init start \r\n");
  syscall_table[SYS_GETPID] = sys_getpid;
  syscall_table[SYS_WRITE] = sys_write;
  syscall_table[SYS_MALLOC] = sys_malloc;
  syscall_table[SYS_FREE] = sys_free;
  put_str("syscall init done \r\n");
}
